// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取权限配置 GET /api/permission/configure/${param0} */
export async function getApiPermissionConfigureByKey(
  params: {
    // path
    key: string;
  },
  options?: { [key: string]: any },
) {
  const { key: param0, ...queryParams } = params;
  return request<API.SimpleResultListPermissionConfigDto>(`/api/permission/configure/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 发布权限配置 POST /api/permission/release-configure */
export async function postApiPermissionReleaseConfigure(
  body: API.PermissionConfigReleaseDto[],
  options?: { [key: string]: any },
) {
  return request<any>('/api/permission/release-configure', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 检查模块权限定义 GET /api/permission/check */
export async function getApiPermissionCheck(options?: { [key: string]: any }) {
  return request<API.NotDataResult>('/api/permission/check', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取权限项集合 GET /api/permission/options */
export async function getApiPermissionOptions(options?: { [key: string]: any }) {
  return request<API.SimpleResultListPermissionOptionsDto>('/api/permission/options', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取API资源 GET /api/permission/resources */
export async function getApiPermissionResources(options?: { [key: string]: any }) {
  return request<API.SimpleResultListPermissionOptionsDto>('/api/permission/resources', {
    method: 'GET',
    ...(options || {}),
  });
}
